package com.example.rabbitmq.demo4_priority_queue;

import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.QueueBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author songyahui
 * @Date 2023/7/13 9:38
 * @Description
 */
@Configuration
public class PriorityConfig {

    @Bean
    public Queue queuePri(){
//      优先级以小为优先，设置范围0-255，不用设置太大消耗内存
        return QueueBuilder.durable("priority_queue").withArgument("x-max-priority", 10).build();
    }


}
